import json
def gojson():
    data = [{"name":"张景红","age":20},{"name":"张景绿","age":21}]
    data_json = json.dumps(data)#转为json
    return data_json
def gopy():
    data = '[{"name":"张景红","age":20},{"name":"张景绿","age":21}]'
    data_py = json.loads(data)#转为python变量
    return(data_py)
print(type(gojson()))
print(type(gopy()))